const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    item: {
      imgUrls: [
        "/images/20140716151115_ercyP.jpeg ",
        "/images/timg.jpg ",
      ],
      indicatorDots: true,
      autoplay: true,
      interval: 5000,
      duration: 1000,
      mode: 'aspectFill',
      circular: true
    },
    li: [{
      nav: "谁浏览了我",
    }, {
      nav: "谁收藏了我",
    }],
    infor: [{
        id: '2',
        img: '/images/20140716151115_ercyP.jpeg',
        name: '名称',
        pos: '职位',
        company: '公司',
        time: '于2019-03-05 19:15:14',
      },
      {
        id: '3',
        img: '/images/20140716151115_ercyP.jpeg',
        name: '名称2',
        pos: '职位2',
        company: '公司2',
        time: '2019-03-05 00:15:14',
      }
    ],
    idx: 0,
    phone:''
  },

  changeStatic: function(e) {
    var item = e.currentTarget.dataset.index
    console.log(item);
    this.setData({
      idx: item
    })
    if (this.data.idx == 1) {
      app.postData2('user/searchCollecData', {}, res => {
        console.log('9.查询谁收藏了我');
        console.log(res);
      })
    } else {
      app.postData2('user/searchVisitData', {}, res => {
        console.log('10.查询谁浏览了我');
        console.log(res);
      })
    }
  },
  // 拨打电话
  phone:function(e){
      wx.makePhoneCall({
        phoneNumber: e.currentTarget.dataset.phone
      })
  },
  
  //根据别人卡片id查询他们的卡片信息
  Others: function(e) {
    var OthersId = e.currentTarget.dataset.id
    console.log('ta的id:' + OthersId);
    if (OthersId == '7') {
      wx.navigateTo({
        url: '../Others/Others?OthersId' + OthersId,
      })
    }
  },
  // 返回按钮
  return:function(){
   wx.navigateTo({
     url: '../index/index',
   })
  },
  onLoad: function(options) {
    // 接口6
    app.postData2('user/searchOther', {}, res => {
      var userData = res.data.data
      this.setData({
        'infor[0].id': userData.id,
        'infor[0].img': userData.user_json.avatarUrl,
        'infor[0].name': userData.name,
        'infor[0].pos': userData.position,
        'infor[0].company': userData.company,
        'infor[0].time': userData.create_time,
        phone:userData.phone
      })
      console.log('6.查询别人card');
      console.log(res);
    })
    console.log(options);
    var type = options.id;
    this.setData({
      idx: type
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})